Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alt text to the Choosing a Programming Tool page. #327

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

acharraggi
Copy link
Collaborator

Add alt text to images and indent ..image directives.
The alt text for images on this page showed the file name.
e.g. <img alt="../../../_images/BlocksPicture11.jpg" src="../../../_images/BlocksPicture11.jpg">

Note: This pages uses ..image instead of the usual ..figure. Each image is preceded by a paragraph about the programming tool so the image is in context. No caption is really required, but we should provide screen reader text in the alt tag.

While testing that in a screen reader I noticed that each numbered list was a list of one item. That's because the ..image directive is not indented so it was ending the list. Then the next numbered item started a new ordered list.
The screen reader was saying things like "A list of one item", then reading number 2 for the 2nd item.
Now it says a list of three items and then reads them in order.

The images properly say the alt text when encountered by the screen reader.

Here's what the RST source looks like now with the alt text and ..image indented.

1. **The Blocks Programming Tool** - A visual, programming tool that
   lets programmers use a web browser to create, edit and save their op
   modes. This tool is recommended for novice programmers and for users
   who prefer to design their op modes visually, using a drag-and-drop
   interface.

   .. image:: images/BlocksPicture1.jpg
      :alt: Screenshot of the Blocks Programming Tool showing a graphical Blocks program.

2. **The OnBot Java Programming Tool** - A text-based programming

Which generates better looking HTML with a proper ordered list and alt text for the images.

<ol class="arabic">
<li><p><strong>The Blocks Programming Tool</strong> - A visual, programming tool that
lets programmers use a web browser to create, edit and save their op
modes. This tool is recommended for novice programmers and for users
who prefer to design their op modes visually, using a drag-and-drop
interface.</p>
<img alt="Screenshot of the Blocks Programming Tool showing a graphical Blocks program." src="[../../../_images/BlocksPicture11.jpg](https://github.com/_images/BlocksPicture11.jpg)" />
</li>
<li><p><strong>The OnBot Java Programming Tool</strong> - A text-based programming

@acharraggi
Copy link
Collaborator Author

Converted the ..image directive to ..figure. Set the figure :alt: to blank because we're adding a visible text captions.

Converted the list to section headings, added a Recommendation header, and made minor text adjustments to make the page more readable as a web page.

I checked the generated PDF and noticed it was putting one image per page that was separate from the text. The PDF generator does tend to float images out of context (which is not good). However, with text captions at least they now have some context. I adjusted the image sizes so that the first two end up on one page and the the remaining images fit with their text on one page.

The web presentation still looks with smaller images. Users can select the image and open it in a new tab if they want full size. I also set figure **:class: no-scaled-link ** since these images did not have a web link before, and I don't thing they need one now.

I think this could be reviewed now.

@acharraggi acharraggi marked this pull request as ready for review November 27, 2024 23:19
@acharraggi acharraggi marked this pull request as draft November 30, 2024 15:52
@acharraggi
Copy link
Collaborator Author

Arrgh!

I was Googling away looking for some reference material for how to write captions when I stumbled upon something that indicated Figures should have both alt text and a caption. I found multiple instances of this, including some tests in various screen readers and browsers.

Here's a couple of pages that did some screen reader testing:

I set the PR back to draft. I'll have to make another change.

Issues

  1. Setting a figure caption and setting alt='' is bad for accessibility.
  2. Setting align and width can cause more problems than expected. Align cause images to float. In the PDF version images can float to the next page out of context with their text. This is bad accessibility. I looked at the current PDF version of the programming tool page and the images are really big. However, they are in context with the text and in the same order as the HTML version. My attempt to pretty up the HTML and PDF by setting Align and width actually made things worse in terms of accessibility by causing images to float to other pages.
  3. It may be fine to use the ..image directive as long as we include alt text. Thoughtbot says "alt descriptions should be functional; figcaption descriptions should be editorial or illustrative." If we don't need editorial or illustrative comments on the image, then the image be presented with a ..image directive.
  4. If we do want to use ..figure, then we need both an :alt: tag and caption text. That alt text and caption needs to be carefully written. See the thoughtbot.com page.

I'll have to revisit the field coordinate system page. Complex images probably still need captions, but now also should have alt text. The idea of functional alt text and editorial captions may help here.

This page has good guidance IMO on how to write alt text with captions.
https://thoughtbot.com/blog/alt-vs-figcaption

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant